import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop018_商品属性删除属性组"

# 1.点击“删除”按钮，确认删除，删除成功。
firefox=openBrowser(url) #调用自定义函数打开网页,url的值是在testData文件中定义的
firefox.get(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")
firefox.find_element_by_xpath("//table/tbody/tr[1]/td[4]/a[2]").click()
firefox.switch_to.alert.accept()
time.sleep(3)

# 断言
try:
    firefox.find_element_by_xpath('//table/tbody/tr[1]/td[4]/a[2]').is_displayed()
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试成功" % testCase)

firefox.quit()